package com.linzm.leetcode.primary.exercises1_20230114;

/**
 * @Author zimingl
 * @Date 2023/1/14 15:35
 * @Description: 正整数和负整数的最大计数
 */
public class Demo5_2529 {
    public static void main(String[] args) {
        int[] nums = {-3, -2, -1, 0, 0, 1, 2};
        Demo5_2529 demo5_2529 = new Demo5_2529();
        int max = demo5_2529.maximumCount(nums);
        System.out.println(max);
    }

    public int maximumCount(int[] nums) {
        int integer = 0;
        int negative = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] < 0) {
                negative++;
            } else if (nums[i] > 0){
                integer++;
            }
        }
        return Math.max(integer, negative);
    }
}
